<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<!-- RichFaces tag library declaration -->
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>

<html>
    <head>

        <title>Motorbike tour organizing system | New trip</title>
	<style type="text/css">
	.label{
	font-weight:bold;
	}
        </style>

        <style type="text/css">
        <c:import url="styles/decoration.css" />
        </style>

    </head>

    <body>

        <f:view>
            <f:subview id="headline">
                <c:import url="header.jsp"/>
            </f:subview>


            <rich:panel header="New trip">
                <h:form>
                    <h:panelGrid columns="3">
                        <h:outputText value="Descripton:"/>
                        <h:inputText title="Short description of the trip." value="#{newTrip.description}" required="true" requiredMessage="Please give the description!" id="desc"/>
                        <h:message for="desc"/>

                        <h:outputText title="Maximum number of participants." value="Limit:"/>
                        <h:inputText value="#{newTrip.limit}" id="lim" validator="#{newTrip.validateLimit}"/>
                        <h:message for="lim"/>

                        <h:outputText title="The length of the trip in kilometers." value="Length (km):"/>
                        <h:inputText value="#{newTrip.dist}" id="len" validator="#{newTrip.validateLength}"/>
                        <h:message for="len"/>

                        <h:outputText value="Map's URL:"/>
                        <h:inputTextarea title="Copy the link from Google Maps! (Not the HTML code.)" rows="5" value="#{newTrip.mapURL}" id="map" required="false" requiredMessage="Please copy the link from Google Maps!"/>
                        <h:message for="map"/>


                        <h:outputText value="From:"/>
                        <rich:calendar value="#{newTrip.from}" id="fromDate"/>
                        <h:message for="fromDate"/>

                        <h:outputText value="To:"/>
                        <rich:calendar value="#{newTrip.to}" id="toDate"/>
                        <h:message for="toDate"/>
                    </h:panelGrid>
                    <rich:pickList value="#{newTrip.lodgingTypes}">
                        <f:selectItem itemLabel="Hotel"  itemValue="Hotel"/>
                        <f:selectItem itemLabel="Motel"  itemValue="Motel"/>
                        <f:selectItem itemLabel="Tent"   itemValue="Tent"/>
                        <f:selectItem itemLabel="Nature" itemValue="Nature"/>
                        <f:selectItem itemLabel="Other"  itemValue="Other"/>
                    </rich:pickList>
                    <h:commandButton value="Add new trip" action="#{newTrip.addNewTrip}"/>
                </h:form>
            </rich:panel>

        </f:view>
    </body>
</html>

